package leecode

import "sort"

func intersection(nums [][]int) []int {
	hashMap := make(map[int]int)
	var result []int
	for i := 0; i < len(nums); i++ {
		for j := 0; j < len(nums[i]); j++ {
			hashMap[nums[i][j]]++
			if hashMap[nums[i][j]] == len(nums) {
				result = append(result, nums[i][j])
			}
		}
	}
	sort.Ints(result)
	return result
}
